package initialize

import (
	"github.com/minio/minio-go/v7"
	"github.com/minio/minio-go/v7/pkg/credentials"
	"github.com/zeromicro/go-zero/core/logx"
)

func MinioInit(endpoint, accessKeyID, secretAccessKey string, useSSL bool) *minio.Client {
	// 初始化minio客户端
	minioClient, err := minio.New(endpoint, &minio.Options{
		Creds:  credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
		Secure: useSSL,
	})
	if err != nil {
		logx.Errorf("建立minio客户端异常：%v", err)
		return nil
	}
	return minioClient
}
